﻿using System;

namespace NJabber.Client
{
    public class SubscriptionRequestEventArgs : EventArgs
    {
        private PresenceSubscriptionRequest request;

        public SubscriptionRequestEventArgs(PresenceSubscriptionRequest request)
        {
            if (request == null) throw new ArgumentNullException("request");
            this.request = request;
        }

        public PresenceSubscriptionRequest Request
        {
            get { return request; }
        }

        public JID RequestJid
        {
            get { return request.EntityJid; }
        }

        public override bool Equals(object obj)
        {
            SubscriptionRequestEventArgs args = obj as SubscriptionRequestEventArgs;
            if (args == null) return false;
            return Equals(args);
        }

        public bool Equals(SubscriptionRequestEventArgs args)
        {
            return RequestJid.Equals(args.RequestJid);
        }
    }
}
